#include <string>

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/stl_bind.h>

#include "utils/logger/logger_internal.h"


namespace py=pybind11;


namespace pytxdnn {

class DefaultLogger {
public:
  DefaultLogger(std::string file_path = "", 
    txdnn::ILogger::Level level = txdnn::ILogger::Level::Warning): 
    level_(level), file_path_(file_path) {
    initLogger();    
  }

  DefaultLogger() {
    initLogger();
  }

  void initLogger() {
    if (file_path_.empty()) {
      logger_ = TXDNN_GetDefaultLogger(nullptr, level_);
    } else {
      logger_ = TXDNN_GetDefaultLogger(file_path_.c_str(), level_);
    }
  }

  // used for C++ internal
  txdnn::ILogger* getLogger() { return logger_; }

public:
  txdnn::ILogger::Level level_ = txdnn::ILogger::Level::Warning;  
  std::string file_path_ = "";

private:
  txdnn::ILogger* logger_ = nullptr;
};


} // namespace pytxdnn
